import request from '@/api/request'
import { ResponseFormat, ResponseFormatWithList, IPaginationFormWithCondition } from '#/http'
import { IRoles } from '@/types/systemManage'

// 新增角色
export const createRoleAPI = (body: IRoles): Promise<ResponseFormat> => {
  return request.post('/roles/create', body)
}

// 查询角色列表
export const queryRolesListAPI = (body: IPaginationFormWithCondition):Promise<ResponseFormatWithList> => {
  return request.post('/roles/list', body)
}

// 删除角色
export const delRoleAPI = (id: string | number): Promise<ResponseFormat> => {
  return request.delete(`/roles/delete/${id}`)
}

// 更新角色
export const updateRoleAPI = (body: IRoles): Promise<ResponseFormat> => {
  return request.post('/roles/update', body)
}

// 获取角色详情
export const getRoleDetail = (id: string | number): Promise<ResponseFormat> => {
  return request.get(`/roles/detail/${id}`)
}
